// api/login.js
import service from '@/utils/request.js'; // 引入封装的 axios 实例

const postApi = {
	list: '/post/list',
	detail: '/post/getPostById',
	postRouting: '/post/add', // 增加帖子接口
	commentList: '/comment/list', //根据帖子Id获取帖子评论
	commentAdd: '/comment/add', //新增评论
	commentLove: '/commentLove/add', //评论点赞
	childrenCommentList: '/comment/getChildrenList', //获取二级评论
	postLove: '/love', //点赞和取消点赞
	postCollect: '/collect', //收藏和取消收藏
	playPost: '/post/playPost' //游玩帖子


};

// 获取帖子列表
export const getPostList = (data) => {
	return service.post(postApi.list, data);
};

export const getPostDetails = (postId) => {
	return service.get(postApi.detail, {
		params: {
			postId
		}
	});
};

export const getCommentList = (data) => {
	return service.get(postApi.commentList, {
		params: data
	});
};

export const getChildrenCommentList = (data) => {
	return service.get(postApi.childrenCommentList, {
		params: data
	});
};
// 新增评论
export const addComment = (data) => {
	return service.post(postApi.commentAdd, data);
};

// 评论点赞
export const commentLove = (data) => {
	return service.post(postApi.commentLove, data);
};

// 帖子点赞
export const postLove = (data) => {
	return service.post(postApi.postLove, data);
};

// 帖子收藏
export const postCollect = (data) => {
	return service.post(postApi.postCollect, data);
};


// 新增帖子
export const postRouting = (data) => {
	return service.post(postApi.postRouting, data);
};

export const playPost = (data) => {
	return service.get(postApi.playPost, {
		params: data
	});
};